﻿using J.Model;
using J.ProductGet.Application.Command.CommercialOwnerControllerCommand;
using MediatR;
using SqlSugar;

namespace J.ProductGet.Application.CommandHandler.CommercialOwnerControllerCommandHandler
{
    public class CommercialOwnerBackilCommandHandler : IRequestHandler<CommercialOwnerBackilCommand, List<CommercialOwner>>
    {
        private readonly ISqlSugarClient _sqlSugarClient;
        public CommercialOwnerBackilCommandHandler(ISqlSugarClient sqlSugarClient)
        {
            _sqlSugarClient = sqlSugarClient;
        }
        public async Task<List<CommercialOwner>> Handle(CommercialOwnerBackilCommand request, CancellationToken cancellationToken)
        {
            return await _sqlSugarClient.Queryable<CommercialOwner>().Where(s => s.MerchantID == request.MerchantID).ToListAsync();
        }
    }
}
